<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="model.*"%>
<%@ page import="dao.*"%>
<%@ page import="java.util.*"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	request.setCharacterEncoding("utf-8");
	response.setCharacterEncoding("utf-8");
	List<Route> routes = new ArrayList<Route>();
	routes = RouteDao.getRoutes();

	request.setAttribute("routes", routes);
	request.setCharacterEncoding("utf-8");
	response.setCharacterEncoding("utf-8");
%>

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Login Form Template</title>

<!-- CSS -->
<link rel="stylesheet"
	href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/form-elements.css">
<link rel="stylesheet" href="assets/css/style.css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->

<!-- Favicon and touch icons -->
<link rel="shortcut icon" href="assets/ico/favicon.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144"
	href="assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114"
	href="assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"
	href="assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed"
	href="assets/ico/apple-touch-icon-57-precomposed.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<link
	href="http://fonts.googleapis.com/css?family=Hind:300,400,500,600,700"
	rel="stylesheet" type="text/css">
<link href="vendor/simple-line-icons/simple-line-icons.min.css"
	rel="stylesheet" type="text/css" />
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"
	type="text/css" />
<link href="css/animate.css" rel="stylesheet">
<link href="vendor/swiper/css/swiper.min.css" rel="stylesheet"
	type="text/css" />

<!-- THEME STYLES -->
<link href="css/layout.min.css" rel="stylesheet" type="text/css" />

<!-- Favicon -->
<link rel="shortcut icon" href="favicon.ico" />
</head>
<!-- END HEAD -->
<jsp:include page="Header.jsp" flush="true"></jsp:include>

</head>

<body>

	<div class="container">
		<div id="旅游路线">
			<div class="content-lg container">
				<div class="row margin-b-40">
					<div class="col-sm-6">
						<h2>旅游路线</h2>
						<p></p>
					</div>
				</div>
				<!--// end row -->
				<div class="row clearfix">
					<c:forEach var="route" items="${routes}" varStatus="status">
						<hr>
						<div class="col-md-12 column">
							<h3>路线名称：${route.rcname }</h3>

						</div>
						<div class="col-md-12 column">
							<div class="col-md-6 column">
								<img height="200" width="300" alt="200x300"
									src="${route.getVroutes()[0].getView().location }" />
							</div>
							<div class="col-md-6 column">

								<ul>
									<li style="list-style-type: none;">旅游时长：${route.days } 天</li>
									<br>

									<li style="list-style-type: none;">旅游金额：${route.money } 元</li>
									<br>
									<li style="list-style-type: none;">景点数量：${route.getVroutes().size() }
										个</li>
									<br>
									<li style="list-style-type: none;"><a class="btn" href="<%=request.getContextPath()%>/RouteListInfo.jsp?rname=${route.rname }">更多信息</a>
										&nbsp;
										<a class="btn"
										href="javascript:if(confirm('确定要添加订单吗?'))
					location='<%=request.getContextPath()%>/RorderServlet?rname=${route.rname }&handle=addRorder'">立刻选购</a></li>
									<li style="list-style-type: none;"></li>
									<hr>
								</ul>
								<p></p>
							</div>
						</div>
						<div class="col-md-12 column"><hr></div>
						<br>
					</c:forEach>
				</div>



				<!-- Javascript -->
				<script src="assets/js/jquery-1.11.1.min.js"></script>
				<script src="assets/bootstrap/js/bootstrap.min.js"></script>

				<script src="assets/js/scripts.js"></script>
				<jsp:include page="Footer.jsp" flush="true"></jsp:include>
				<!-- Back To Top -->
				<a href="javascript:void(0);" class="js-back-to-top back-to-top">Top</a>

				<!-- JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
				<!-- CORE PLUGINS -->
				<script src="vendor/jquery.min.js" type="text/javascript"></script>
				<script src="vendor/jquery-migrate.min.js" type="text/javascript"></script>
				<script src="vendor/bootstrap/js/bootstrap.min.js"
					type="text/javascript"></script>

				<!-- PAGE LEVEL PLUGINS -->
				<script src="vendor/jquery.easing.js" type="text/javascript"></script>
				<script src="vendor/jquery.back-to-top.js" type="text/javascript"></script>
				<script src="vendor/jquery.smooth-scroll.js" type="text/javascript"></script>
				<script src="vendor/jquery.wow.min.js" type="text/javascript"></script>
				<script src="vendor/swiper/js/swiper.jquery.min.js"
					type="text/javascript"></script>
				<script src="vendor/masonry/jquery.masonry.pkgd.min.js"
					type="text/javascript"></script>
				<script src="vendor/masonry/imagesloaded.pkgd.min.js"
					type="text/javascript"></script>
				<!--[if lt IE 10]>
            <script src="assets/js/placeholder.js"></script>
        <![endif]-->
</body>

<%
	String flag = "";
	String scerror = "";
	flag = (String) request.getAttribute("flag");
	System.out.println("jspflag" + flag);
	if (flag != null) {
		if (flag.equals("1")) {
			scerror = "添加成功。";
			out.print("<script language='javascript'>alert('" + scerror + "');</script>");
		}
		if (flag.equals("0")) {
			scerror = "添加失败,该订单已经存在";
			out.print("<script language='javascript'>alert('" + scerror + "');</script>");
		}

	}
	System.out.println(scerror);
%>
</html>